"""
@File    : loginBusiness.py
@Author  : qve-wzy
@Time    : 2020/9/2 0002 16:32
"""

from handle.handleLogin import LoginPageHandle

class  LoginPageBusiness:
    '''
    业务层
    '''
    def __init__(self,i):
        '''
        初始化
        '''
        self.login_handle = LoginPageHandle(i)

    def go_login(self):
        '''
        首次login
        '''
        self.login_handle.one_login()
        print('第一次登陆business')


    def login_pass(self):
        '''
        登陆
        '''
        self.login_handle.send_username('18513199586')
        self.login_handle.send_password('111111')
        self.login_handle.click_login()
        self.login_handle.get_fail_tost("账号异常")

    def login_user_error(self):
        '''
        账号不存在
        :return:
        '''
        self.login_handle.send_username('18513199587')
        self.login_handle.send_password('111111')
        self.login_handle.click_login()
        user_flag = self.login_handle.get_fail_tost('帐号未注册')
        if user_flag:
            return True
        else:
            return False

    def login_password_error(self):
        '''
        密码错误
        :return:
        '''
        self.login_handle.send_username('18513199586')
        self.login_handle.send_password('111112')
        self.login_handle.click_login()
        user_flag = self.login_handle.get_fail_tost('登陆密码错误')
        if user_flag:
            return True
        else:
            return False


